﻿@model HuaHan.WorkTicket.Domain.Customer

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h5>客户信息设定</h5>
</div>
<div class="modal-body">
    @using (Ajax.BeginForm("CreateAndEdit", null, new AjaxOptions { HttpMethod = "POST", OnSuccess = "SuccessCreate", OnFailure = "FailureCreate" }, new { @class = "form-horizontal", id = "form1" }))
    {     
        @Html.HiddenFor(c => c.CustomerID)
        @Html.HiddenFor(c => c.CreatedAt)
        @Html.HiddenFor(c => c.UpdatedAt)
        
        
        <div class="box-content">
            <ul class="nav nav-tabs" id="myTab">
                <li class="active"><a href="#info">基本信息</a></li>
                <li class=""><a href="#contact">联系方式</a></li>
                <li class=""><a href="#custom">财务信息</a></li>
                <li class=""><a href="#messages">其他信息</a></li>
            </ul>

            <div id="myTabContent" class="tab-content">
                <div class="tab-pane active" id="info">

                    <div class="control-group">
                        @Html.LabelFor(c => c.NO, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(c => c.NO, new { @class = "input-xlarge uneditable-input",Readonly="readonly"})
                        </div>
                    </div>

                        <div class="control-group">
                            @Html.LabelFor(c => c.CN_Name, new { @class = "control-label" })
                            <div class="controls">
                                @Html.TextBoxFor(c => c.CN_Name, new { @class = "input-xxlarge focused"})
                            </div>
                        </div>

                    <div class="control-group">
                        @Html.LabelFor(c => c.Region, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(c => c.Region, new { @class = "input-xlarge focused" })
                        </div>
                    </div>


                    <div class="control-group">
                        @Html.LabelFor(c => c.City, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(c => c.City, new { @class = "input-xlarge focused" })
                        </div>
                    </div>


                    <div class="control-group">
                        @Html.LabelFor(c => c.CompanyAddress, new { @class = "control-label active" })
                        <div class="controls">
                            @Html.TextBoxFor(c => c.CompanyAddress, new { @class = "input-xxlarge focused" })
                        </div>
                    </div>

                    <div class="control-group">
                        @Html.LabelFor(c => c.ReceiptAddress, new { @class = "control-label active" })
                        <div class="controls">
                            @Html.TextBoxFor(c => c.ReceiptAddress, new { @class = "input-xxlarge focused" })
                        </div>
                    </div>


                </div>
                <div class="tab-pane" id="custom">
                    <div class="row">
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.Chieftain, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.Chieftain, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.Chieftain)
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.Bankroll, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.Bankroll, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.Bankroll)
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.FinancialPerson, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.FinancialPerson, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.FinancialPerson)
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.FinancialPhone, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.FinancialPhone, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.FinancialPhone)
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.BankName1, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.BankName1, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.BankName1)
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.BankNo1, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.BankNo1, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.BankNo1)
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.BankName2, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.BankName2, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.BankName2)
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.BankNo2, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.BankNo2, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.BankNo2)
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="tab-pane" id="messages">
                    <div class="control-group">
                        @Html.LabelFor(c => c.Description, new { @class = "control-label active" })
                        <div class="controls">
                            @Html.TextBoxFor(c => c.Description, new { @class = "input-xxlarge focused" })
                            @Html.ValidationMessageFor(c => c.Description)
                        </div>
                    </div>
                </div>
                <div class="tab-pane" id="contact">
                    <div class="row">
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.ManagerName, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.ManagerName, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.ManagerName)
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                             <div class="control-group">
                                @Html.LabelFor(c => c.Email, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.Email, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.Email)
                                </div>
                            </div>
                        </div>
                        
                    </div>

                    <div class="row">
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.Zip, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.Zip, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.Zip)
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.Tel, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.Tel, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.Tel)
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.Fax, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.Fax, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.Fax)
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.Website, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.Website, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.Website)
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.ContactPerson, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.ContactPerson, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.ContactPerson)
                                </div>
                            </div>
                        </div>
                        <div class="span6">
                            <div class="control-group">
                                @Html.LabelFor(c => c.ContactMobile, new { @class = "control-label active" })
                                <div class="controls">
                                    @Html.TextBoxFor(c => c.ContactMobile, new { @class = "input-xlarge focused" })
                                    @Html.ValidationMessageFor(c => c.ContactMobile)
                                </div>
                            </div>
                        </div>
                    </div>


                </div>
            </div>
        </div>

        <div class="form-actions">
            <button type="submit" class="btn btn-primary" id="btnSubmit">保存</button>
            <input type="button" class="btn" id="btnCancel" value="取消" />
        </div>
    }

</div>

<script>
    $(document).ready(function () {

        $('#myTab a').click(function (e) {
            e.preventDefault();
            $(this).tab('show');
        });


        $("#form1").validate({
            rules: {
                CN_Name: {
                    required: true
                },
                Region:{
                    required: true
                },
                City: {
                    required: true
                }
            },
            messages: {
                CN_Name: "请输入客户名称",
                Region: "请输入区域",
                City: "请输入城市"
            },
            errorClass: "error",
            errorElement: "div"
        });

        $("#btnSubmit").click(function () {
            if ($("#form1").validate() == false) {
                return;
            }
        });

        $("#btnCancel").click(function () {
            $('#createAndEditModal').modal('hide');
            return;
        });

    });
</script>
@*    <div class="modal-footer">
        <a href="#" class="btn">关闭</a>
        <a href="#" class="btn btn-primary">Save changes</a>
    </div>*@



